package com.it.park.controller.user;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.it.park.client.service.ArticleCollectService;
import com.it.park.constant.Constant;
import com.it.park.model.ArticleCollect;
import com.it.park.rms.client.model.User;

@Controller
@RequestMapping("/user/collect")
public class UserCollect {
	private String rootPath=Constant.USER_PATH;
	
	@Autowired
	private ArticleCollectService collectService;
	
	/**
	 * 显示我收藏的文章
	 */
	@RequestMapping("collectArticle")
	public String collectArticle(HttpSession session,HttpServletRequest request){
		User user = (User) session.getAttribute("user");
		List<ArticleCollect> collects =  collectService.list(user.getId());//我的收藏
		request.setAttribute("collects", collects);
		return rootPath+"user/userCollectArticle";
	} 
	
	
}
